home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / Buch / Noten2a.cpp < prev    next >
C/C++ Source or Header  |  1998-12-27  |  1KB  |  35 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Noten2a.h"
  6. //---------------------------------------------------------------------------
  7. #pragma resource "*.dfm"
  8. TForm1 *Form1;
  9. int Zensur, Punkte;
  10.  
  11. //---------------------------------------------------------------------------
  12. __fastcall TForm1::TForm1(TComponent* Owner)
  13.     : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17. void __fastcall TForm1::Button1Click(TObject *Sender)
  18. {
  19.   try
  20.   {
  21.     Punkte = StrToInt (Edit1->Text);
  22.     if ((Punkte >= 95) && (Punkte <= 100)) Label1->Caption = "sehr gut";
  23.     if ((Punkte >= 80) && (Punkte < 95)) Label1->Caption = "gut";
  24.     if ((Punkte >= 65) && (Punkte < 80)) Label1->Caption = "befriedigend";
  25.     if ((Punkte >= 45) && (Punkte < 65)) Label1->Caption = "ausreichend";
  26.     if ((Punkte >= 25) && (Punkte < 45)) Label1->Caption = "mangelhaft";
  27.     if ((Punkte >= 0) && (Punkte < 25)) Label1->Caption = "ungenⁿgend";
  28.     if ((Punkte > 100) || (Punkte < 0)) Label1->Caption = "gemogelt!";
  29.   }
  30.   catch (...)
  31.   {
  32.     Label1->Caption = "Was soll der Quatsch?";
  33.   }
  34. }
  35. //---------------------------------------------------------------------------